#include "task.h"
#include <iostream>

co_async::Task<int> hello1(int num) {
  std::cout << "hello1: " << num << std::endl;
  co_return num;
}

co_async::Task<int> hello2(int num) {
  std::cout << "hello2: " << num << std::endl;
  co_return num;
}
co_async::Task<int> hello() {
  std::cout << "begin hello()" << std::endl;
  int a = co_await hello1(1);
  int b = co_await hello2(2);
  co_return a + b;
}

int main() {
  auto t = hello();
  while (!t.get_handle().done()) {
    t.get_handle().resume();
  }
  std::cout << "hello result:" << t.get_handle().promise().result()
            << std::endl;
}